package com.inspire.tank.decorator;

import com.inspire.tank.GameObject;

import java.awt.*;

/**
 * @author inspire
 * @description
 * @date 2022/6/19 20:16
 */
public class TailDecorator extends GODecorator {
    public TailDecorator(GameObject gameObject) {
        super(gameObject);
    }

    @Override
    public void paint(Graphics g) {
        this.x=gameObject.x;
        this.y=gameObject.y;
        gameObject.paint(g);

        Color c=g.getColor();
        g.setColor(Color.YELLOW);
        g.drawLine(gameObject.x,gameObject.y,gameObject.x+getWidth(),gameObject.y+getHeight());
        g.setColor(c);
    }

    @Override
    public int getWidth() {
        return super.gameObject.getWidth();
    }

    @Override
    public int getHeight() {
        return super.gameObject.getHeight();
    }
}
